import Vue from 'vue';
import Vuex from 'vuex';
import getters from './getters.js';
import actions from './actions.js';
import mutations from './mutations.js';

Vue.use(Vuex);

let lifeData = {};

try{
	// 尝试获取本地是否存在lifeData变量，第一次启动APP时是不存在的
	lifeData = uni.getStorageSync('lifeData');
}catch(e){
	
}

const state = {
	invitation: lifeData.invitation,
	isAuth: lifeData.isAuth,
	loginInfo: lifeData.loginInfo,
	userInfo: lifeData.userInfo,
	agentInfo: lifeData.agentInfo,
	mainBaseUrl: 'https://rqzbn.ty666.cn',//'https://zty.zhkg66.cn',
	baseUrl: uni.getSystemInfoSync().platform==='ios'&&lifeData.baseUrl?lifeData.baseUrl: 'https://rqzbn.ty666.cn', //'https://zty.zhkg66.cn',
	uploadUrl: uni.getSystemInfoSync().platform==='ios'&&lifeData.uploadUrl?lifeData.uploadUrl:'https://rqzbn.ty666.cn/index/ajax/upload',
	storeParams: null,
	isAgree: true,
	copyContent: '',
	historyList: lifeData.historyList?lifeData.historyList:[],
	visitorList: [],
	visitorIds: [],
	shareInfo: null,
	appId: 'wxbcd9df98e27a5b8f',//'wx5cd23c6b7782ece2',
	originalId: 'gh_45a9c043af0e',
	
};
const store = new Vuex.Store({
	state,
	getters,
	actions,
	mutations
});
export default store;